﻿@model S4Store.Models.AfterSaleReport.AfterSaleHealthyCarBrand_RCTCModel
@{
    Layout = null;
    ViewBag.Title = "SaleTimeRate";
    var container = "div" + Guid.NewGuid().ToString();
}
<script type="text/javascript">
    $(function () {
        var $c = $("#myContentArea");
        var count = $("#myContentArea").find("table td").has(".value").size();
        var right = parseInt($("#right").css("width").replace("px", "")) - 20;
        if (count * 190 + 70 >= right) {
            $c.width(count * 190 + 70);
        }
    });
</script>
<div style="height: 100%; width: 100%; overflow: auto;">
<div id="myContentArea" style="overflow:hidden">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div class="pagetitle">各车型入厂台次差异</div>
<div style="position:relative; width:100%">
    @{

        S4Store.Models.Chart.Column ChartModel = new S4Store.Models.Chart.Column();
        ChartModel.Colors = new List<string> { S4Store.Models.Chart.Color.Green, S4Store.Models.Chart.Color.Blue };
        //ChartModel.Name = "登记客户";
        ChartModel.YAxis = "常态维修业绩车型KPI";
        //ChartModel.Width = 500;
        //ChartModel.Height = 300;
        foreach(var item in Model.RCTCList)
        {
            ChartModel.XAxis.Add(item.车型名称);
        }

        S4Store.Models.Chart.ChartSeries series1 = new S4Store.Models.Chart.ChartSeries();
        series1.Name = "目标入厂台次进度";
        foreach(var item in Model.RCTCList)
        {
            series1.Data.Add(ViewBag.时间进度*100);
        }
        ChartModel.Serieses.Add(series1);


        S4Store.Models.Chart.ChartSeries series2 = new S4Store.Models.Chart.ChartSeries();
        series2.Name = "实际入厂台次进度";
        foreach(var item in Model.RCTCList)
        {
            series2.Data.Add((item.月应时台次 == 0 ? 0 : ((decimal)item.实际台次 / (decimal)item.月应时台次)) * 100);
        }
        ChartModel.Serieses.Add(series2);
    
    
        @Html.Partial("../Chart/Column", ChartModel)
        <div style=" margin-left:70px; overflow:hidden">
        <table style="width:100%">
            <tr>
            @foreach(var item in Model.RCTCList)
            {
                decimal 目标入厂台次进度 = Math.Round( ViewBag.时间进度 * 100,0,MidpointRounding.AwayFromZero);
                decimal 实际入厂台次进度 = Math.Round((item.月应时台次 == 0 ? 0 : ((decimal)item.实际台次 / (decimal)item.月应时台次)) * 100,0,MidpointRounding.AwayFromZero);
                <td align="center" width="30">
                @if (实际入厂台次进度 < 目标入厂台次进度)
                {
                    <a class="specialRed" href="@Url.Action("CarBrand_RCTCKPI", new { brandid = item.车型ID })" target="navtab" title="@(item.车型名称)常态维修入厂台次过程KPI">
                        <div class="value">@(实际入厂台次进度 - 目标入厂台次进度)%</div>
                        <div class="rt">实际台次：@item.实际台次</div>
                        <div class="rb">应时台次：@item.应时台次</div>
                    </a>
                }
                else
                {
                    <a class="specialGreen" href="@Url.Action("CarBrand_RCTCKPI", new { brandid = item.车型ID })" target="navtab" title="@(item.车型名称)常态维修入厂台次过程KPI">
                        <div class="value">@(实际入厂台次进度 - 目标入厂台次进度)%</div>
                        <div class="rt">实际台次：@item.实际台次</div>
                        <div class="rb">应时台次：@item.应时台次</div>
                    </a>
                }

                </td>
                }
            </tr>
        </table>
        </div>
        
        }
    
</div>
</div>
</div>